def gen_grammar(filename):
	ip=open('E:\project\\aqas\grammar\grammar.cfg',"r")
	flag=0
	grammar=[]
	while True:
		lin=ip.readline()
		if lin=='':
			break
		words=lin.split()
		if len(words)==4:
			g_dict={words[0]:[words[2]]}
			grammar.append([g_dict,words[3]])
		if len(words)==5:
			g_dict={words[0]:[words[2],words[3]]}
			grammar.append([g_dict,words[4]])
	return grammar
	
